class WinMoneyLight extends egret.Bitmap{
	private timeOnEnterFrame = 0;
	private speed:number = 0.1;
	private oldrotation = 0.1;
	public constructor() {
          super();
		  this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
	}
	public onAddToStage(){
		
        let texture:egret.Texture = RES.getRes('light_png');
		this.texture = texture;
		
		this.addEventListener(egret.Event.ENTER_FRAME,this.onEnterFrame,this);
		this.timeOnEnterFrame = egret.getTimer();
		return this;
	}
	private onEnterFrame(e:egret.Event){
        var now = egret.getTimer();
        var time = this.timeOnEnterFrame;
        var pass = now - time;
		var t=this.rotation;
		
		if(this.rotation-this.oldrotation>0){
			if((this.rotation<50 && this.rotation >0) || this.rotation>330){
             this.rotation += this.speed*pass;
			}else{
             this.rotation -= this.speed*pass;
			}
		}else{
			if((this.rotation<50 && this.rotation >0) || this.rotation>330){
             this.rotation -= this.speed*pass;
			}else{
             this.rotation += this.speed*pass;
			}
		}
		this.oldrotation=t;
	
		//this.rotation += this.speed*pass;
        this.timeOnEnterFrame = egret.getTimer();
		
	}
}